package jvm.classloader;

/**
 *双亲委派机制    安全
 * 1.Boot
 * 2.Extend
 * 3.App
 */

public class CarLoader {
    public static void main(String[] args) {
        Class<Car> carClass = Car.class;
        Car car1 = new Car();
        Car car2 = new Car();
        Car car3 = new Car();

        /**
        System.out.println(car1.getClass().hashCode());
        System.out.println(car2.getClass());
        System.out.println(car3.getClass());
        System.out.println(carClass.hashCode());
         */
        Class<String> stringClass = String.class;
        ClassLoader carClassLoader = carClass.getClassLoader();
        ClassLoader classLoader = CarLoader.class.getClassLoader();
        System.out.println(carClassLoader);
        System.out.println(classLoader.getParent());
        System.out.println(stringClass.getClassLoader());
    }


}

class Car {
    public int age;
}
